package com.hhh.tools.ui.components

import android.util.Log
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.hhh.tools.ui.navigation.Destinations
import com.hhh.tools.ui.screens.*

@Composable
fun NavHostApp() {
    val navController = rememberNavController()
    Log.e("hhh", "ComposeNavigation")
    NavHost(
        navController = navController,
        startDestination = Destinations.MainPage.route
    ) {
        composable(Destinations.MainPage.route) {
            MainPage(navController = navController)
        }
        composable(Destinations.SettingPage.route) {
            SettingPage(navController = navController)
        }
        composable(Destinations.AboutPage.route) {
            AboutPage(navController = navController)
        }
        composable(Destinations.Base64Page.route) {
            Base64Page(navController = navController)
        }
        composable(Destinations.Md5Page.route) {
            Md5Page(navController = navController)
        }
        composable(Destinations.BaseConversionPage.route) {
            BaseConversionPage(navController = navController)
        }
        composable(Destinations.UniCodePage.route) {
            CommodityListScreen()
        }
        composable(Destinations.CopyContentPage.route + "/{content}") { backStackEntry ->
            CopyContentPage(backStackEntry.arguments?.getString("content"))
        }
    }
}

@Preview
@Composable
fun NavHostAppPreview() {
    NavHostApp()
}